Enabled GitHub Actions to Run Tests on Pull Request #392
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added a Powershell script named
Generate-TestWorkflows.ps1
that generates a workflow for each test project. Paths are built based onProjectReference
elements in the.csproj
files (recursively) so that a change doesn't run any tests that don't have a dependency on the project that has the change. Common project files always run all of the tests. Markdown files are always ignored.To keep the workload to a minimum, tests are only performed on Windows and Linux and only on .NET 5, .NET Core 2.1, and .NET Framework 4.8 all in x64 in Release mode. This should catch nearly every issue a contributor is likely to encounter. We will run a more thorough check in the CI and Nightly builds.
Reporting is a bit of an issue. We enabled the console logger so the test results are written to the console, which is the best view. For details, each job has artifacts that can be downloaded that contain a Markdown report and a TRX file.
Test Failures
The few tests that are known to occasionally fail have been marked with the
AwaitsFixAttribute
. This takes them out of the "normal" flow so they do not execute by default when working in Visual Studio or when submitting a PR.The default has been changed to run them when using Azure DevOps during CI, Nightly, and Release builds so we don't lose visibility of them.
This change allows us to use a zero tolerance rule when getting contributions - that is, we don't merge anything that causes one or more tests to fail.
Future Improvements
There is a clever way to add a markdown file as a comment to a PR, but there doesn't seem to be a way to fire an event after multiple workflows have finished running, and doing so for each workflow would cause a lot of unnecessary noise on the PR.
There is also a feature request for using paths per job which might help us down the road, which would mean the script would need to be changed to generate a single file with all of the jobs in it. This would at least allow us to put all of the artifacts in one place, but the lack of anything like an Azure DevOps stage is still preventing us from being able to summarize all of the test reports into a single comment on the PR.